import { SET_IDCARD_IMG,SET_INSURANCE_IMG,SET_CAROUSEL_IMG} from "./actionsTypes";
export const setIdCardImg = data => ({type: SET_IDCARD_IMG, data: data});//身份证图片
export const setInsurance = data => ({type: SET_INSURANCE_IMG, data: data}); //交强险图片
export const setCarouselImg = data => ({type: SET_CAROUSEL_IMG, data: data}); //展示放大图片

import uploadPageService from  '../services/uploadPageService';
import {Toast} from 'antd-mobile'

//兑换HTTPS 图片
export const exchangeUploadImg=(data,callBack)=>{
    return (dispatch, getState)=> {
        Toast.hide();
        Toast.loading("", 30, () => Toast.info("网络错误", 2));
                
        uploadPageService.exchangeImg(data).then(resultData => {
            Toast.hide();
            if (resultData.code == 1000) {
                // dispatch(getDefaultAddress(resultData.body))
                callBack&&callBack()
            } else {
                Toast.info(resultData.msg, 1)
            }
        },()=>{
			Toast.hide(); 
            Toast.info("系统繁忙，请稍后再试");
		})
    }
}